<?php

/**
 *
 * @license   https://www.rongyun.cc
 * @link      https://www.rongyun.cc
 * @author    wangyadong<wangyadong280@gmail.com>
 * @date      2017-05-11 18:29
 */

namespace App\Transformers;

use Illuminate\Foundation\Auth\User;
use League\Fractal;
use League\Fractal\TransformerAbstract;


class UserTransformer extends TransformerAbstract
{
    /**
     * List of resources possible to include
     *
     * @var array
     */
    protected $availableIncludes = [];

    protected $defaultIncludes = [];

    /**
     * Transform object into a generic array
     *
     * @var $resource
     * @return array
     */
    public function transform(User $user)
    {
        return [
            'id'    => $user->id,
            'name'  => $user->name,
            'email' => $user->email,
        ];
    }
}